<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ctg="http://www.crotouristguide.com/taglib"
	xmlns:c="http://java.sun.com/jstl/core">

<ui:component>
	<s:div styleClass="rich-separator">
		<h:form>
			<h:outputText value="#{messages['label.sort.by']}" />
			<a:commandLink value="#{messages['label.sort.by.nazivu']}"
				action="#{objektSearch.orderBy('naziv', true)}"
				reRender="divObjekti">
				<c:if test="#{param.idZupanije!=null}">
					<f:param name="idZupanije" value="#{param.idZupanije}" />
				</c:if>
				<c:if test="#{param.idOtoka!=null}">
					<f:param name="idOtoka" value="#{param.idOtoka}" />
				</c:if>
				<c:if test="#{param.idMjesta!=null}">
					<f:param name="idMjesta" value="#{param.idMjesta}" />
				</c:if>
				<c:if test="#{param.idTipaObjekta!=null}">
					<f:param name="idTipaObjekta" value="#{param.idTipaObjekta}" />
				</c:if>
				<f:param name="l" value="#{currentLang}" />
			</a:commandLink>
			<ctg:nbsp />
			<h:outputText value="&nbsp;|&nbsp;" />
			<ctg:nbsp />
			<a:commandLink value="#{messages['label.sort.by.popularnosti']}"
				action="#{objektSearch.orderBy('ocjena', false)}"
				reRender="divObjekti">
				<c:if test="#{param.idZupanije!=null}">
					<f:param name="idZupanije" value="#{param.idZupanije}" />
				</c:if>
				<c:if test="#{param.idOtoka!=null}">
					<f:param name="idOtoka" value="#{param.idOtoka}" />
				</c:if>
				<c:if test="#{param.idMjesta!=null}">
					<f:param name="idMjesta" value="#{param.idMjesta}" />
				</c:if>
				<c:if test="#{param.idTipaObjekta!=null}">
					<f:param name="idTipaObjekta" value="#{param.idTipaObjekta}" />
				</c:if>
				<f:param name="l" value="#{currentLang}" />
			</a:commandLink>
			<ctg:nbsp />
			<h:outputText value="&nbsp;|&nbsp;" />
			<ctg:nbsp />
			<a:commandLink value="#{messages['label.sort.by.posjetima']}"
				action="#{objektSearch.orderBy('brojPosjeta', false)}"
				reRender="divObjekti">
				<c:if test="#{param.idZupanije!=null}">
					<f:param name="idZupanije" value="#{param.idZupanije}" />
				</c:if>
				<c:if test="#{param.idOtoka!=null}">
					<f:param name="idOtoka" value="#{param.idOtoka}" />
				</c:if>
				<c:if test="#{param.idMjesta!=null}">
					<f:param name="idMjesta" value="#{param.idMjesta}" />
				</c:if>
				<c:if test="#{param.idTipaObjekta!=null}">
					<f:param name="idTipaObjekta" value="#{param.idTipaObjekta}" />
				</c:if>
				<f:param name="l" value="#{currentLang}" />
			</a:commandLink>
		</h:form>
	</s:div>
	<h:form id="form">
		<ctg:status />
		<a:region renderRegionOnly="true">
			<s:div id="divObjekti">
				<rich:dataTable id="objekti" rows="20"
					columnClasses="rich-separator,rich-separator" value="#{objekti}"
					var="objekt" width="100%" styleClass="list50">
					<h:column>
						<s:div styleClass="leftm">
							<h2><h:outputLink
								value="#{application.contextPath}/guides/objekti/objekt.seam">
								<f:param name="idObjekta" value="#{objekt.idObjekta}" />
								<f:param name="l" value="#{currentLang}" />
								<f:param name="title" value="#{titleAction.getUrlTitle(objekt)}" />
								<h:outputText
									value="#{messages[stringUtil.merge(objekt.tipObjekta.idTipaObjekta)]}" />
								<ctg:nbsp />
								<h:outputText value="#{objekt.naziv}" />
							</h:outputLink> <h:outputLink
								value="#{application.contextPath}/guides/otoci/otok.seam"
								rendered="#{!empty objekt.mjesto.otok}">
								<f:param name="idOtoka" value="#{objekt.mjesto.otok.idOtoka}" />
								<f:param name="l" value="#{currentLang}" />
								<f:param name="title"
									value="#{titleAction.getUrlTitle(objekt.mjesto.otok)}" />
								<h:outputText value=", #{objekt.mjesto.otok.naziv}" />
							</h:outputLink> <h:outputLink
								value="#{application.contextPath}/guides/mjesta/mjesto.seam">
								<f:param name="idMjesta" value="#{objekt.mjesto.idMjesta}" />
								<f:param name="l" value="#{currentLang}" />
								<f:param name="title"
									value="#{titleAction.getUrlTitle(objekt.mjesto)}" />
								<h:outputText value=", #{objekt.mjesto.naziv}" />
							</h:outputLink></h2>
						</s:div>
						<s:div styleClass="right price">
							<f:subview rendered="#{objekt.minCijena != objekt.maxCijena}">
								<b><h:outputText value="#{objekt.minCijena} EUR"
									rendered="#{objekt.minCijena != null}"></h:outputText> <ctg:nbsp />
								- <ctg:nbsp /> <h:outputText value="#{objekt.maxCijena} EUR"
									rendered="#{objekt.maxCijena != null}"></h:outputText></b>
							</f:subview>
							<f:subview rendered="#{objekt.minCijena == objekt.maxCijena}">
								<b><h:outputText value="#{objekt.minCijena} EUR"
									rendered="#{objekt.minCijena != null}"></h:outputText></b>
							</f:subview>
						</s:div>
						<br class="clearb" />
						<s:div styleClass="left top">
							<s:div styleClass="leftm">
								<h:outputLink
									value="#{application.contextPath}/guides/objekti/objekt.seam">
									<f:param name="idObjekta" value="#{objekt.idObjekta}" />
									<f:param name="l" value="#{currentLang}" />
									<f:param name="title"
										value="#{titleAction.getUrlTitle(objekt)}" />
									<img
										alt="#{messages['label.image.alt']} #{objekt.naziv},#{obj.mjesto.naziv}"
										width="140" height="95"
										src="#{slikaAction.getPocSlikaPath(objekt,'s')}"> </img>
								</h:outputLink>
							</s:div>
							<s:div styleClass="left infotxt">
								<a:region>
									<a:commandLink id="compareBtn"
										title="#{messages['label.objekt.compare.desc']}"
										action="#{objektCompare.selectObjekt(objekt)}"
										styleClass="special2" reRender="divObjekti">
										<h:outputText
											value="#{messages['label.objekt.compare.select']}"
											rendered="#{!objektCompare.isForCompare(objekt.idObjekta)}"></h:outputText>
										<h:outputText
											value="#{messages['label.objekt.compare.deselect']}"
											rendered="#{objektCompare.isForCompare(objekt.idObjekta)}"></h:outputText>
										<c:if test="#{param.idZupanije!=null}">
											<f:param name="idZupanije" value="#{param.idZupanije}" />
										</c:if>
										<c:if test="#{param.idOtoka!=null}">
											<f:param name="idOtoka" value="#{param.idOtoka}" />
										</c:if>
										<c:if test="#{param.idMjesta!=null}">
											<f:param name="idMjesta" value="#{param.idMjesta}" />
										</c:if>
										<c:if test="#{param.idTipaObjekta!=null}">
											<f:param name="idTipaObjekta" value="#{param.idTipaObjekta}" />
										</c:if>
										<f:param name="idListForCompareStr"
											value="#{listIConverter.getAsString(null,null,objektCompare.idListForCompare)}" />
										<f:param name="page" value="#{param.page}" />
									</a:commandLink>
								</a:region>
								<br />
								<h:outputText value="#{messages['label.kategorija.ocjena']}:"
									rendered="#{objekt.kategorija != null}"></h:outputText>
								<h:graphicImage alt="#{messages['label.image.alt']}"
									value="/resources/images/class_#{objekt.kategorija.brojZvjezdica}star.gif" />

								<s:div rendered="#{objekt.ocjena != null}" styleClass="clearfix">
									<s:div styleClass="left">
										<h:outputText value="#{messages['label.rate']}" />
									</s:div>
									<s:div styleClass="left" style="width:110px">
										<ctg:rate value="#{objekt.ocjena}" readOnly="true" />
									</s:div>
								</s:div>
								<s:div>
									<h:outputLink rendered="#{objekt.brojDojmova != 0}"
										value="#{application.contextPath}/guides/objekti/objekt.seam">
										<f:param name="idObjekta" value="#{obj.idObjekta}" />
										<f:param name="l" value="#{currentLang}" />
										<f:param name="title" value="#{titleAction.getUrlTitle(obj)}" />
										<f:param value="#reviews"></f:param>
										<h:outputFormat value="#{messages['label.reviews.number']}">
											<f:param value="#{objekt.brojDojmova}"></f:param>
										</h:outputFormat>
									</h:outputLink>
									<s:div rendered="#{objekt.brojSlika != 0}">
										<i> <h:outputFormat
											value="#{messages['label.images.number']}">
											<f:param value="#{objekt.brojSlika}"></f:param>
										</h:outputFormat> </i>
									</s:div>
									<h:outputText value="#{messages['label.ctg_id']}: " />
									<h:outputText value="#{obj.ctgId}" />
								</s:div>

							</s:div>
							<br class="clearb" />
						</s:div>
						<s:div styleClass="left top">
							<p><h:outputText
								value="#{stringUtil.substring(objekt.getOpis(currentLang).opis,250)}" />
							<h:outputLink
								value="#{application.contextPath}/guides/objekti/objekt.seam"
								styleClass="special2">
								<f:param name="idObjekta" value="#{objekt.idObjekta}" />
								<f:param name="l" value="#{currentLang}" />
								<f:param name="title" value="#{titleAction.getUrlTitle(objekt)}" />
								<h:outputText value="#{messages['label.link.more']}" />
							</h:outputLink></p>
						</s:div>
						<br class="clearb" />
					</h:column>
					<f:facet name="footer">
						<h:panelGroup>
							<a:outputPanel id="compareFooter" ajaxRendered="true">
								<a:commandButton
									value="#{messages['label.objektsearch.button.compare']}"
									disabled="#{objektCompare.idListForCompare.size() lt 2}"
									rendered="#{objekti.size > 0}" action="compareSelected" />
								<h:outputText
									value="#{messages['label.objektsearch.message.compare']}"
									rendered="#{objektCompare.idListForCompare.size() > 0}" />
							</a:outputPanel>
						</h:panelGroup>
					</f:facet>
				</rich:dataTable>
				<ctg:dataScroller dataTableId="objekti" bookmarkable="true"
					showpages="10" selectedStyleClass="currentPage">
					<f:param name="sp"
						value="#{spConverter.getAsString(null,null,searchParameters)}" />
					<f:param converter="#{listIConverter}" name="idListForCompareStr"
						value="#{listIConverter.getAsString(null,null,objektCompare.idListForCompare)}" />
					<c:if test="#{param.idZupanije!=null}">
						<f:param name="idZupanije" value="#{param.idZupanije}" />
					</c:if>
					<c:if test="#{param.idOtoka!=null}">
						<f:param name="idOtoka" value="#{param.idOtoka}" />
					</c:if>
					<c:if test="#{param.idMjesta!=null}">
						<f:param name="idMjesta" value="#{param.idMjesta}" />
					</c:if>
					<c:if test="#{param.idTipaObjekta!=null}">
						<f:param name="idTipaObjekta" value="#{param.idTipaObjekta}" />
					</c:if>
					<f:param name="l" value="#{currentLang}" />
					<f:param name="title"
						value="#{titleAction.getUrlTitle(searchParameters)}" />
				</ctg:dataScroller>
			</s:div>
			<br />
			<br />
		</a:region>
	</h:form>
</ui:component>

</html>